import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        /**
         * 是否需要强制登录
         */
        forcedLogin: false,
        hasLogin: false,//是否已经登录
		loginRole:'',//登录角色
		mobile:'',//登录手机号
        userName: "",//登录名称
		adminName:'',//理财师登录名称
		token:''//登录token
    },
    mutations: {
        login(userName,token,mobile) {
            state.userName = userName || '普通客户';
            state.hasLogin = true;
			state.loginRole=1;
			state.token=token;
			state.mobile=mobile;
        },
	    loginAdmin(adminName) {
		    state.adminName = adminName || '理财师';
		    state.hasLogin = true;
			state.loginRole=3;
		},
        logout(state) {
            state.userName = "";
			state.adminName="";
			state.loginRole="";
            state.hasLogin = false;
			state.token='';
        }
    }
})

export default store
